﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'SelectMovimientos')
	BEGIN
		DROP  Procedure  SelectMovimientos
	END

GO

CREATE Procedure SelectMovimientos
(
	@movimientoID int
)
AS
BEGIN
	SET NOCOUNT ON

	SELECT
	M.[movimientoID],
	M.[loteID],
	M.[almacenID],
	M.[cantidad],
	M.[motivo],
	M.[saldo],
	M.[operacionID],
	M.[personalID],
	M.[fecha],
	L.insumoID
	FROM [Movimientos] AS M
	INNER JOIN Lotes AS L ON M.loteID = L.loteID
	WHERE M.[movimientoID] = @movimientoID

	SET NOCOUNT OFF
END

GO

GRANT EXEC ON SelectMovimientos TO PUBLIC

GO


